import Item from "../Articles/item";
import Pagination from "../Articles/Pagination";
const Articles = (props) => {
  let { currentPage, count, onPageClick, articles, isShowPage } = props;
  if (!articles) {
    return <div className="article-preview">加载中</div>;
  }
  if (articles && articles.length == 0) {
    return <div className="article-preview">暂无文章</div>;
  }
  return (
    <div>
      {articles.map((article) => {
        return <Item article={article} key={article.slug} />;
      })}
      {isShowPage ? (
        <Pagination
          count={count}
          currentPage={currentPage}
          onPageClick={onPageClick}
        />
      ) : null}
    </div>
  );
};

export default Articles;
